/**
 * @author 赵希奥
 * @date 2022/3/31 1:44
 * @gitHub https://github.com/CKXGZXA
 * @gitee https://gitee.com/ckxgzxa
 * @description: 客户端测试类
 * 学院2020级
 * 下设10个班级，每个班级30个学生
 * 还有3位学生，由于各种原因，不属于任何班级
 * 使用组合模式完成对于班级、学生的通知模块
 */
public class Client {
    public static void main(String[] args) {
        // 创建学院
        SchoolComponent school = new Class("学院2020级");

        // 新建10个班级
        SchoolComponent class1 = new Class("202001");
        SchoolComponent class2 = new Class("202002");
        SchoolComponent class3 = new Class("202003");
        SchoolComponent class4 = new Class("202004");
        SchoolComponent class5 = new Class("202005");
        SchoolComponent class6 = new Class("202006");
        SchoolComponent class7 = new Class("202007");
        SchoolComponent class8 = new Class("202008");
        SchoolComponent class9 = new Class("202009");
        SchoolComponent class10 = new Class("202010");
        // 用for循环给每个班级增加30个学生
        for (int i = 0; i < 30; i++) {
            class1.add(new Student("202001" + String.format("%02d", i + 1)));
            class2.add(new Student("202002" + String.format("%02d", i + 1)));
            class3.add(new Student("202003" + String.format("%02d", i + 1)));
            class4.add(new Student("202004" + String.format("%02d", i + 1)));
            class5.add(new Student("202005" + String.format("%02d", i + 1)));
            class6.add(new Student("202006" + String.format("%02d", i + 1)));
            class7.add(new Student("202007" + String.format("%02d", i + 1)));
            class8.add(new Student("202008" + String.format("%02d", i + 1)));
            class9.add(new Student("202009" + String.format("%02d", i + 1)));
            class10.add(new Student("202010" + String.format("%02d", i + 1)));
        }
        // 还有3位学生不属于任何班级
        Student student1 = new Student("20201101");
        Student student2 = new Student("20201102");
        Student student3 = new Student("20201103");

        // 将班级和学生添加到学院
        school.add(class1);
        school.add(class2);
        school.add(class3);
        school.add(class4);
        school.add(class5);
        school.add(class6);
        school.add(class7);
        school.add(class8);
        school.add(class9);
        school.add(class10);
        school.add(student1);
        school.add(student2);
        school.add(student3);

        // 从学院开始通知
        school.notice();
    }
}
